package com.wx.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.wx.dao.WxUserEventMapper;
import com.wx.entity.WxUserEvent;
import com.wx.entity.WxUserEventExample;
import com.wx.entity.WxUserEventGroupBy;
import com.wx.service.WxUserEventService;
import com.wx.vo.WxUserEventResult;

@Service("wxUserEventService")
public class WxUserEventServiceImpl implements WxUserEventService {
	@Resource
	private WxUserEventMapper wxUserEventMapper;

	@Override
	public int insert(WxUserEvent record) {
		return wxUserEventMapper.insert(record);
	}

	@Override
	public int insertSelective(WxUserEvent record) {
		return wxUserEventMapper.insertSelective(record);
	}

	@Override
	public List<WxUserEvent> selectByExample(WxUserEventExample example) {
		return wxUserEventMapper.selectByExample(example);
	}
	@Override
	public List<WxUserEventGroupBy> selectGroupByDate(String open_id){
		return wxUserEventMapper.selectGroupByDate(open_id);
	}
	@Override
	public WxUserEvent selectByPrimaryKey(Integer id) {
		return wxUserEventMapper.selectByPrimaryKey(id);
	}

	@Override
	public WxUserEvent selectByOpenId(String openid) {
		WxUserEventExample example = new WxUserEventExample();
		example.createCriteria().andOpenidEqualTo(openid);
		List<WxUserEvent> list = wxUserEventMapper.selectByExample(example);
		if(list.size() == 1)
			return list.get(0);
		else
		return null;
	}

	@Override
	public List<WxUserEventResult> selectFanCountByMonth(String wxid,Integer month) {
		return wxUserEventMapper.selectFanCountByMonth(wxid, month);
	}
	
	@Override
	public List<WxUserEventResult> getFanCountByMonthShort(String wxid,Integer month) {
		return wxUserEventMapper.selectFanCountByMonthShort(wxid, month);
	}
}
